package com.example.postgresql.service.impl;

import com.example.postgresql.dao.MessageDao;
import com.example.postgresql.dao.MsmDao;
import com.example.postgresql.entity.Message;
import com.example.postgresql.entity.Msm;
import com.example.postgresql.service.MsmService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;



@Service("msmService")
public class MsmServiceImpl implements MsmService {

    @Resource
    private MsmDao msmDao;


    public Map<String,Object> insert(Msm msm) {
        Map<String, Object> map = new HashMap<String, Object>();
        int list = msmDao.insert(msm);
        map.put("code", 0);
        map.put("msg", "");
        map.put("data", list);
        return map;
    }

    @Override
    public Map<String, Object> queryAll(Msm msm) {
        Map<String, Object> map = new HashMap<String, Object>();
        List<Msm> list = msmDao.queryAll(msm);
        map.put("code", 0);
        map.put("msg", "");
        map.put("count", list.size());
        map.put("result", list);
        return map;
    }
}
